<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>随机方块</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/random_box.css">
    <script src="js/tools.js"></script>
    <script src="js/random_box.js"></script>
</head>
<body>
<div id="container">

</div>

<script>
    let container = document.getElementById('container');
    let boxs = [];
    for (let i = 0; i < 100; i++) {
        let r = Tools.getRandom(0,255);
        let g = Tools.getRandom(0,255);
        let b = Tools.getRandom(0,255);
        let box = new Box(container,{
            backgroundColor:'rgb('+r+','+g+','+b+')'
        });
        boxs.push(box);
        box.random()
    }
    function randomBox() {
        for (let i = 0; i < boxs.length; i++) {
            let box = boxs[i];
            box.random()
        }
    }
    //setInterval(randomBox,1500)
</script>
</body>
</html>
